<template>
  <div>
    <mt-header>
      <div slot="left" @click="back">
        <mt-button icon="back">返回</mt-button>
      </div>
    </mt-header>

    <mt-button @click="test">btn</mt-button>
    <div>
      <img class="img_content" :src="url" alt>
    </div>
  </div>
</template>
<script>
import { mapState, mapActions } from "vuex";

export default {
  name: "ImageDetail",
  data() {
    return {
      url: "",
      girlsList: null
    };
  },
  computed: {
    // 這是映射 store.state.todayInfo ，所以才 undefined
    ...mapState(["girlsInfo", "todayInfo", "detailInfo"])
  },
  methods: {
    ...mapActions(["initGirls", "loadDays"]),
    back() {
      this.$router.go(-1);
    },
    async initData() {
      await this.initGirls();
      console.log("girlsInfo=", this.girlsInfo);
      this.girlsList = [...this.girlsInfo];
      console.log("this.girlsList=", this.girlsList);
    },
    test() {
      let playload = {date: "2019/01/03"};
      this.loadDays(playload).then(
        success => {
          console.log("success", success);
          console.log('detailInfo=', this.detailInfo);
        },
        error => {
          console.log(error);
        }
      );
    }
  },
  created() {
    // const url = this.$route.params.url;
    const url = this.$route.query.url;
    this.url = url;
  }
};
</script>
<style scoped>
.img_content {
  width: 100%;
  height: 100%;
}
</style>
